[FEA] Add support for scalar column views in AST expressions and JIT execution - #23615
[FEA] Add support for scalar column views in AST expressions and JIT execution#23615lamarrr wants to merge 2 commits into
Conversation
- Introduced `scalar_column_view` handling in the `literal` class. - Updated `row_ir` to accommodate both scalar columns and scalar column views. - Enhanced input handling in JIT execution to support new scalar types. - Added a new benchmark for wide table transformations in NVBench.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR adds scalar column view support to AST literals and Row IR inputs. It also adds and registers a configurable wide-table transform benchmark for AST, JIT, and optimized JIT executors. ChangesAST and JIT transform support
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cpp/benchmarks/transform/transform_widetable.cpp`:
- Around line 75-76: Run clang-format on the create_sequence_table call in the
benchmark setup, ensuring the wrapped arguments align according to the project's
formatting rules. Limit the change to formatting in transform_widetable.cpp.
- Around line 21-25: Add the direct standard-library headers <utility> for
std::move and <cstddef> for std::size_t in the include section of
transform_widetable.cpp, alongside the existing headers.
In `@cpp/include/cudf/ast/expressions.hpp`:
- Around line 303-308: Update the Doxygen documentation for the
scalar_column_view constructor of literal to explicitly note that the referenced
one-row column must outlive the literal and every JIT evaluation using it,
reflecting its non-owning lifetime requirement.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 9d6a2d79-4f72-48f3-81ef-fc3b9708f791
📒 Files selected for processing (5)
cpp/benchmarks/CMakeLists.txtcpp/benchmarks/transform/transform_widetable.cppcpp/include/cudf/ast/expressions.hppcpp/src/jit/row_ir.cppcpp/src/jit/row_ir.hpp
| /** | ||
| * @brief Construct a new literal object. | ||
| * | ||
| * @param value A scalar column view value | ||
| */ | ||
| literal(scalar_column_view value) : scalar{std::move(value)} {} |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Document the non-owning lifetime requirement.
literal retains a non-owning scalar_column_view. cpp/src/jit/row_ir.cpp later forwards that view into transform_args.inputs. If the referenced column is destroyed before JIT evaluation, the transform can access invalid device memory.
Add a Doxygen note that the referenced one-row column must outlive the literal and every JIT evaluation that uses it.
Proposed documentation change
/**
* `@brief` Construct a new literal object.
*
* `@param` value A scalar column view value
+ * `@note` `value` is non-owning. The referenced one-row column must outlive this
+ * `literal` and every evaluation that uses it.
*/📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * @brief Construct a new literal object. | |
| * | |
| * @param value A scalar column view value | |
| */ | |
| literal(scalar_column_view value) : scalar{std::move(value)} {} | |
| /** | |
| * `@brief` Construct a new literal object. | |
| * | |
| * `@param` value A scalar column view value | |
| * `@note` `value` is non-owning. The referenced one-row column must outlive this | |
| * `literal` and every evaluation that uses it. | |
| */ | |
| literal(scalar_column_view value) : scalar{std::move(value)} {} |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cpp/include/cudf/ast/expressions.hpp` around lines 303 - 308, Update the
Doxygen documentation for the scalar_column_view constructor of literal to
explicitly note that the referenced one-row column must outlive the literal and
every JIT evaluation using it, reflecting its non-owning lifetime requirement.
Source: Coding guidelines
There was a problem hiding this comment.
@lamarrr Can you confirm this? I don't recall the ownership model of scalar_column_view but I think this is incorrect.
There was a problem hiding this comment.
That's the lifetime requirement for all cuDF column/scalar view types. It would be noise to re-document that at every usage site
Description
This PR allows AST literals used by the JIT executor to reference a preconstructed
scalar_column_view. Previously, every scalar literal was materialized as a one-row column onevery JIT transform call. That setup cost dominates workloads that repeatedly evaluate expressions
over wide tables or small row batches.
The change:
cudf::ast::literalto hold either an existingcudf::scalaror a non-owningscalar_column_view.cudf::transformwhile retaining ownership of columns materialized for the existing scalar path.
ast_jit_wide_tabletoTRANSFORM_NVBENCH, covering:ast,jit, andjit-optexecutors.In the benchmark,
jituses AST literals backed bycudf::scalar, whilejit-optusesequivalent literals backed by preconstructed
scalar_column_viewobjects.A literal constructed from a
scalar_column_viewis non-owning. The referenced one-row column mustremain alive for the lifetime of the literal and its evaluation.
Performance
Measured on an NVIDIA RTX A6000 with 262,144 total rows and a table width of one. Expression depth
and rows per transform call were swept from 1 to 128 and 512 to 131,072, respectively.
jit-optspeedup overjitAt expression depth 128:
A matched Nsight Systems profile at depth 16 and 1,024 rows per call showed that both paths execute
the same 256 JIT transform kernels with effectively identical transform-kernel time (0.601 ms versus
0.599 ms). Reusing scalar-column views removed 4,096 scalar copy kernels and 4,096 async copies,
reducing the profiled benchmark range from 189.9 ms to 21.1 ms (8.98x).
Checklist